//
//  ViewController.swift
//  day04
//
//  Created by 杨绍鑫 on 2018/9/7.
//  Copyright © 2018年 crcnet. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    @IBOutlet weak var scrollVIew: UIScrollView!
    let leftVC = LeftVC.init(nibName: "LeftVC", bundle: Bundle.main)
    let rightVC = RightVC.init(nibName: "RightVC", bundle: Bundle.main)
    let camerVC = CamerVC.init(nibName: "CamerVC", bundle: Bundle.main)
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }

    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        UIApplication.shared.isStatusBarHidden = true
        self.addChildViewController(leftVC)
        leftVC.didMove(toParentViewController: self)
        scrollVIew.addSubview(leftVC.view)
        
        self.addChildViewController(camerVC)
        camerVC.didMove(toParentViewController: self)
        scrollVIew.addSubview(camerVC.view)
        
        self.addChildViewController(rightVC)
        rightVC.didMove(toParentViewController: self)
        scrollVIew.addSubview(rightVC.view)
        
        var camerF = camerVC.view.frame
        camerF.origin.x = self.view.frame.size.width
        camerVC.view.frame = camerF
        
        var rightF = rightVC.view.frame
        rightF.origin.x = self.view.frame.size.width * 2
        rightVC.view.frame = rightF
        
        scrollVIew.contentSize = CGSize.init(width: self.view.frame.size.width * 3, height: self.view.frame.size.height)
    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}

